#include<bits/stdc++.h>
using namespace std;
int n,c,x[1000010];
int maxMin(); 
int main()
{
	int i;
	cin>>n>>c;
	for(i=1;i<=n;i++)
		cin>>x[i];
	sort(x+1,x+i);
	cout<<maxMin(); 
    return 0;
}
int maxMin()
{
	int L=1,R=x[n]/c,mid;
	int result=-1,i;
	while(L<=R)
	{
		mid=L+(R-L)/2;
//		distance=x[mid]-x[1];
		int cnt=1,last=1;
		for(i=2;i<=n;i++)
		{
			if(x[i]-x[last]>=mid)
			{
				cnt++;
				last=i;
			}
		}
		if(cnt>=c)
		{
			result=mid;
			L=mid+1;
		}
		else
			R=mid-1;
	}
	return result;
}
